﻿@model IEnumerable<PhotoBlog.Core.Models.Request>

@{
    ViewBag.Title = "Заявки";
}
<div class="table-responsive">
    <table class="table">
        <tr>
            <th>
                Фамилия Имя
            </th>
            <th>
                Контактная информация
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Comment)
            </th>
            <th>
                Образ
            </th>
            <th>
                Макияж
            </th>
            <th>
                Дата
            </th>
            <th></th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.LastName)&nbsp;@Html.DisplayFor(modelItem => item.FirstName)
                </td>
                <td>
                    @{
            var htmlStr = new List<string>();
            if (!string.IsNullOrEmpty(item.ContactInfo))
            {
                var tArrStr = item.ContactInfo.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);
                foreach (var s in tArrStr)
                {
                    var isLink = s.IndexOf(@"htt", StringComparison.Ordinal);
                    if (isLink != -1)
                    {
                        htmlStr.Add("<a href='" + s + "'>" + s + "</a>");
                    }
                    else
                    {
                        htmlStr.Add(s);
                    }
                }
                item.ContactInfo = string.Join(" ", htmlStr.ToArray());
            }
                    }
                    @Html.Raw(item.ContactInfo)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Comment)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.CreateForm)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Makeup)
                </td>
                <td>
                    @Html.ActionLink("Delete", "Delete", new { id = item.RequestId })
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Date)
                </td>
            </tr>
        }
    </table>
</div>

